﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Lm.Common.DAL
{
    public interface IDAL
    {
        long Insert<T>(Expression<Func<T>> fields) where T : IModelBase;
        bool Insert<T>(T model) where T : IModelBase;
        int Delete<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        int Update<T>(T model, params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        int Update<T>(Expression<Func<T, T>> fields, params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        List<T> Select<T>(Expression<Func<T>> selectFields, Expression<Func<T>> orderByFields, OrderByOption option, params Expression<Func<T, bool>>[] conditions) where T : IModelBase, new();
        List<T> Select<T>(long pageSize, long pageIndex, out long recordCount, Expression<Func<T>> selectFields, Expression<Func<T>> orderByFields, OrderByOption option, Expression<Func<T, bool>>[] conditions) where T : IModelBase, new();
        List<T> Select<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase, new();
        int Count<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        bool Exist<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        bool IsSingle<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase;
        T GetSingle<T>(params Expression<Func<T, bool>>[] conditions) where T : IModelBase, new();
    }
}
